import pytz
from datetime import date

from celery import Celery

from utils import run_necessary_task
from db.models import Shipping
from db.utils import get_engine_and_session_of_db, close_engine_and_session_of_db
from scraper import main as scraper_main


app = Celery(
    'scraper_centraldispatch',
    broker='redis://redis:6379/0',
    backend='redis://redis:6379/0',
    timezone = pytz.timezone('Europe/Moscow')
)

run_necessary_task(app)

@app.task
def track_appearance_sheepments() -> None:
    """ Отслеживаем появление новых перевозок """
    scraper_main.main()
